import { ImageName } from '@/mota/data/ImageLoader';

export const attckTypeList = [
    [0, "无", "#FFFFFF", "无"],
    [1, "先攻", "#FFFFFF", "此怪物会比勇士先发动攻击"],
    [2, "连击", "#FFFF00", "此怪物每回合会多次攻击勇士"],
    [3, "吸血", "#FF6A6A", "此怪物战斗前勇士会被吸取一定百分比的血量"],
    [4, "魔攻", "#97FFFF", "此怪物战斗时无视勇士的防御"],
    [5, "近卫", "#CAFF70", "此怪物战斗时模仿勇士攻击(当勇士攻击大于怪物防御时)"]
] as const;

export type AttckTypeInfo = typeof attckTypeList[number];

export type BattleType = `0` | `1` | `${2}&${number}` | `${3}&${number}` | `4` | `5`;

/**
 * 战斗信息
 * [怪物名称, 血量,攻击力,防御力,金币,经验,特殊能力]
 */
export type BattleInfo = readonly [ImageName, number, number, number, number, number, BattleType];

export const battleList: BattleInfo[] = [
    ["绿史莱姆", 80, 18, 1, 2, 1, "0"],
    ["红史莱姆", 100, 20, 3, 3, 2, "0"],
    ["黑史莱姆", 200, 35, 10, 8, 5, "0"],
    ["银史莱姆", 8000, 888, 670, 120, 120, "0"],
    ["金史莱姆", 15000, 1300, 1000, 310, 280, "0"],
    ["史莱姆王", 30000, 5000, 1200, 600, 580, "0"],
    ["史莱姆魔皇", 50000, 5500, 4300, 1000, 1000, "0"],
    ["梦魇", 99999, 9999, 9999, 999, 999, "0"],
    ["小蝙蝠", 100, 27, 5, 4, 2, "0"],
    ["大蝙蝠", 350, 63, 31, 18, 14, "3&0.03"],
    ["红蝙蝠", 550, 190, 110, 30, 22, "3&0.08"],
    ["冥灵分身", 1750, 888, 766, 175, 175, "1"],
    ["骷髅人", 220, 45, 12, 11, 10, "0"],
    ["骷髅武士", 250, 65, 28, 20, 12, "0"],
    ["骷髅队长", 500, 95, 51, 30, 18, "0"],
    ["冥队长", 3333, 1200, 1133, 112, 100, "0"],
    ["初级法师", 115, 53, 27, 10, 7, "4"],
    ["中级法师", 240, 300, 120, 28, 25, "4"],
    ["高级法师", 600, 680, 550, 55, 41, "4"],
    ["麻衣法师", 400, 250, 100, 34, 30, "4"],
    ["无界法师", 560, 460, 330, 40, 40, "4"],
    ["兽人", 300, 165, 80, 35, 30, "0"],
    ["兽人武士", 1000, 560, 400, 55, 55, "0"],
    ["初级卫兵", 300, 45, 62, 22, 19, "0"],
    ["中级卫兵", 450, 380, 220, 43, 40, "1"],
    ["高级卫兵", 750, 600, 400, 60, 55, "1"],
    ["圣骑士", 130, 630, 125, 68, 65, "1"],
    ["骑士护卫", 550, 540, 350, 70, 70, "2&3"],
    ["骑士队长", 800, 580, 370, 84, 80, "2&5"],
    ["幽灵", 380, 800, 200, 80, 80, "2&2"],
    ["石头人", 600, 300, 300, 45, 42, "0"],
    ["双手剑士", 600, 750, 170, 88, 88, "2&4"],
    ["冥斗士", 650, 360, 260, 80, 76, "1"],
    ["冥骷髅", 600, 350, 238, 71, 63, "3&0.08"],
    ["大法师分身", 1680, 868, 768, 168, 168, "3&0.25"],
    ["魔法警卫", 1000, 800, 660, 500, 500, "4"],
    ["魔王ZENO", 999999, 18000, 10000, 1000, 1000, "4"],
    ["魔法卫兵", 680, 650, 590, 111, 111, "4"],
    ["黑暗骑士", 900, 780, 690, 100, 100, "1"],
    ["魔龙头", 3500, 1200, 580, 0, 0, "3&0.1"],
    ["魔龙角", 800, 1200, 641, 0, 0, "1"],
    ["魔龙心", 10000, 120, 999, 0, 0, "4"],
    ["魔龙左翼", 2000, 810, 800, 0, 0, "0"],
    ["魔龙右翼", 2000, 810, 800, 0, 0, "0"],
    ["魔龙左尖刺", 1000, 1000, 641, 0, 0, "2&4"],
    ["魔龙右尖刺", 1000, 1000, 641, 0, 0, "2&4"],
    ["魔龙左爪", 641, 1800, 40, 0, 0, "1"],
    ["魔龙右爪", 641, 1800, 40, 0, 0, "1"],
    ["弱化ZENO", 1641, 210, 36, 0, 0, "4"],
    ["破坏神分身", 2564, 641, 555, 1, 641, "5"],
    ["ZENO分身", 6666, 666, 666, 0, 0, "4"],
    ["远古护卫", 1000, 888, 750, 500, 500, "5"],
    ["魔物首领古顿", 80000, 14000, 8400, 800, 800, "2&66"],
    ["冥灵魔王", 8000, 17410, 5900, 800, 800, "1"],
    // ["魔法警卫2", 1000, 800, 800, 800, 800, "5"],
    ["模仿者", 9999, 6700, 3000, 0, 0, "1"],
    ["魔化仙子", 6666, 1414, 666, 0, 0, "2&13"]
];

export type BattlesMap = { [name in ImageName]?: BattleInfo; };

const battleMap = {} as BattlesMap;

for (const info of battleList) {
    battleMap[info[0]] = info;
}

export function GetEnemyInfo(image: ImageName) {
    const info = battleMap[image];
    return info;
}

export function GetAttckTypeInfo(battleType: BattleType) {
    return attckTypeList[parseInt(battleType)];
}